import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import static java.lang.Thread.sleep;

public class Test02 {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver=new ChromeDriver();
        webDriver.get("https://www.baidu.com/");
        //设置历览器大小200*200
        webDriver.manage().window().setSize(new Dimension(200,400));
        sleep(3000);
        //滚动条滚动到底部
        ((JavascriptExecutor)webDriver).executeScript("document.documentElement.scrollTop=10000");
        sleep(3000);
        //滚动条滚动到顶部
        ((JavascriptExecutor)webDriver).executeScript("document.documentElement.scrollTop=0");
        sleep(3000);
        webDriver.close();
    }
}

